package org.extreme.base;

import java.awt.Color;

public abstract class StyleUtils implements StyleConstants {
	
	public static int getBorderWidth(int borderType) {
    	switch (borderType) {
		case LINE_NONE:
			return 0;
		case LINE_THIN:
			return 1;
		case LINE_DASH:
			return 1;
		case LINE_HAIR:
			return 1;
		case LINE_HAIR2:
			return 1;
		case LINE_THICK:
			return 3;
		case LINE_DOT:
			return 1;
		default:
			return 2;
		}
    }

	/**
	 * Convert java color to css string.
	 */
	public static String javaColorToCSSColor(Color c) {
		StringBuffer cssBuf = new StringBuffer("rgb(");
		cssBuf.append(c.getRed());
		cssBuf.append(",");
		cssBuf.append(c.getGreen());
		cssBuf.append(",");
		cssBuf.append(c.getBlue());
		cssBuf.append(")");

		return cssBuf.toString();
	}
}
